import { connect } from 'react-redux';
import reducer, { getCommentList } from '../store/comment';
import { injectReducer } from '../store/reducers';
import { withRouter } from 'react-router-dom';
import store from '../store/createStore';
import Comment from '../components/detail/Comment';

const mapDispatchToProps = {
  getCommentList
};

const mapStateToProps = state => ({
  dataList: state.comment.list,
  pageSize: state.comment.pageSize,
  totalNum: state.comment.totalNum
});

injectReducer(store, { key: 'comment', reducer });

export default withRouter(
  connect(
    mapStateToProps,
    mapDispatchToProps
  )(Comment)
);
